package com.jin;

import org.junit.Test;
import com.jin.六大设计原则.单一原则.违背.VideoUserService;
import com.jin.六大设计原则.单一原则.顺从.GuestVideoUserService;
import com.jin.六大设计原则.单一原则.顺从.OrdinaryVideoUserService;
import com.jin.六大设计原则.单一原则.顺从.VipVideoUserService;

//违背单一原则，调用方法时所有的指责用户都使用一个方法实现
public class testServeGrade {
    @Test
    public void test(){
        VideoUserService videoUserService = new VideoUserService();
        videoUserService.serveGrade("VIP会员");
        videoUserService.serveGrade("普通会员");
        videoUserService.serveGrade("访客用户");
    }



    //不违背单一原则，每个类都只负责自己的用户行为，拓展新的功能或者修改某个用户的行为类都可以方便的开发和维护
    @Test
    public void test_videoUserService(){

        System.out.println("==============================");
        //访客用户
        GuestVideoUserService guestVideoUserService = new GuestVideoUserService();
        guestVideoUserService.definition();
        guestVideoUserService.advertisement();

        //普通用户
        OrdinaryVideoUserService ordinaryVideoUserService = new OrdinaryVideoUserService();
        ordinaryVideoUserService.definition();
        ordinaryVideoUserService.advertisement();

        //vip用户
        VipVideoUserService vipVideoUserService = new VipVideoUserService();
        vipVideoUserService.definition();
        vipVideoUserService.advertisement();
    }

}


